import qs from 'qs'
import { HTTP } from '../utils/httpRequestUtil'
import { COMMON } from '../utils/commonUtil'
import URL from './api'
export default {
  getToken (cb) {
    HTTP.post(URL.getToken, {}).then(function (response) {
      cb(response)
    }).catch(function (error) {
      cb(error.response)
    })
  },
  getMenuPermission (params, cb) {
    HTTP.post(URL.getMenuPermission, qs.stringify(params)).then(function (response) {
      cb(response)
    }).catch(function (error) {
      COMMON.showHttpError()
    })
  },
  getWritePermission (params, cb) {
    HTTP.post(URL.getWritePermission, qs.stringify(params)).then(function (response) {
      cb(response)
    }).catch(function (error) {
      COMMON.showHttpError()
    })
  },
  getDoneTaskList (params, cb) {
    HTTP.post(URL.getDoneTaskList, qs.stringify(params)).then(function (response) {
      cb(response)
    }).catch(function (error) {
      COMMON.showHttpError()
    })
  }
}